package com.homework.action;

import java.util.Map;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.homework.service.UserService;

public class LogoutSystemAction extends ActionSupport {
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public String execute() {
		// 清除session
		Map<String, Object> attibutes = ActionContext.getContext().getSession();
		Object userId = attibutes.get("userId");
		attibutes.clear();

		UserService userService = new UserService();
		// 更改用户状态
		userService.updateUserStatus(userId, 2);

		return SUCCESS;
	}

}
